package com.example.sharding.service.impl;

import com.example.sharding.model.UserModel;
import com.example.sharding.repository.UserRepository;
import com.example.sharding.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author 刘房
 * @Title: ${file_name}
 * @Package ${package_name}
 * @Description: ${todo}
 * @date 2020/8/816:42
 */
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Service
//@Transactional
public class UserServiceImpl implements IUserService {

    @Autowired
    private UserRepository userRepository;

//    @Transactional(readOnly = true)
    @Override
    public void save(UserModel userModel) {
        userRepository.save(userModel);
    }

    @Override
    public List<UserModel> findAll() {
        return userRepository.findAll();
    }
}
